const redisClient = require("@/redis/redis-client");
const redisKeysConstant = require("@/constants/redis-keys.constant");

/**
 * 应用启动初始化函数
 */
function startUp() {
	console.log("应用启动中");
	redisInit();
}

/**
 * redis 应用启动后设置初始值
 */
async function redisInit() {
	try {
		console.log("startup->开始初始化redis");
		const keys = await redisClient.get(redisKeysConstant.filePreviewKeys); // 检查文件预览的keys是否存在，不存在初始化
		if (!keys) {
			redisClient.set(redisKeysConstant.filePreviewKeys, []);
		}
	} catch (error) {}
}

module.exports = startUp;
